package com.hns.can.common.service;

import com.hns.can.common.constants.GlobalConst;
import com.hns.can.common.formula.FillCodeDscValue;
import com.hns.can.common.formula.FillParamsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 基础数据填充处理类
 * @author:zhangzq
 * @email:
 * @version Revision 2.0.0
 */
@Component
public class BaseInfoValueService {

    @Autowired
    private FillCodeDscValue codeDscValue;

    /**
     * @param list
     * @author:zhangzq
     * @email:
     * @创建日期:2016-05-10
     * @功能说明：填充组织名称，线路名称，车牌
     */
    public void fillOrganLineLicPltNo(List list) throws Exception {
        Map<String,String> map = new HashMap<String,String>();
        map.put("organName", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo1 = new FillParamsVo("organId", map);
        map = new HashMap<String,String>();
        map.put("lineName", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo2 = new FillParamsVo("lineId", map);
        map = new HashMap<String,String>();
        map.put("licPltNo", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo3 = new FillParamsVo("carId", map);
        codeDscValue.fillInfoValue(list,new String[]{GlobalConst.CACHE_KEY_BASE_ORGAN,GlobalConst.CACHE_KEY_BASE_LINE_INFO,GlobalConst.CACHE_KEY_BASE_CAR_INFO},vo1,vo2,vo3);
    }
    
    /**
     * @param list
     * @author:zhangzq
     * @email:
     * @创建日期:2016-05-10
     * @功能说明：填充组织名称，线路名称，车牌, 电池型号
     */
    public void fillOrganLineLicPltNoBatteryType(List list) throws Exception {
    	fillOrganLineLicPltNo(list);
    	Map<String,String> map = new HashMap<String,String>();
        map.put("bteryMaterialType", "BYT00000");
        codeDscValue.fillCodeDscValue(list, map);
    }
    
    /**
     * @param list
     * @author:zhangzq
     * @email:
     * @创建日期:2016-05-10
     * @功能说明：填充组织名称，线路名称，车牌, 电池, 车辆型号
     */
    public void fillOrganLineLicPltNoBatteryCarType(List list) throws Exception {
    	fillOrganLineLicPltNo(list);
    	Map<String,String> map = new HashMap<String,String>();
        map.put("bteryMaterialType", "BYT00000");
        map.put("carType", "CAT00000");
        codeDscValue.fillCodeDscValue(list, map);
    }
    
    /**
     * @param list
     * @author:zhangzq
     * @email:
     * @创建日期:2016-05-10
     * @功能说明：填充组织名称，线路名称，驾驶员
     */
    public void fillOrganLineDrvName(List list) throws Exception {
    	Map<String,String> map = new HashMap<String,String>();
        map.put("lineName", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo1 = new FillParamsVo("lineId", map);
        map = new HashMap<String,String>();
        map.put("organName", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo2 = new FillParamsVo("organId", map);
        map = new HashMap<String,String>();
        map.put("drvName", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo3 = new FillParamsVo("drvId", map);
        codeDscValue.fillInfoValue(list,new String[]{GlobalConst.CACHE_KEY_BASE_LINE_INFO,GlobalConst.CACHE_KEY_BASE_ORGAN,GlobalConst.CACHE_KEY_BASE_DRV_INFO},vo1,vo2,vo3);
    }
}
